//
//  DiseaseTypeController.m
//  FastDoctor
//
//  Created by 李通 on 16/7/9.
//  Copyright © 2016年 sc. All rights reserved.
//

#import "DiseaseTypeController.h"

@interface DiseaseTypeController ()

@property (nonatomic,strong) NSArray *typeList;

@end

@implementation DiseaseTypeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.tableFooterView = [[UIView alloc]init];
}

#pragma mark - delegateSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.typeList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    if (!cell) {
        
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = self.typeList[indexPath.row];
    return cell;
}

#pragma mark - delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (self.typeBlock) {
        
        self.typeBlock(self.typeList[indexPath.row]);
    }
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - 懒加载数据
- (NSArray *)typeList {
    
    if (!_typeList) {
        
        _typeList = @[@"肿瘤科",@"心血管科",@"血液科",@"神经科",@"骨科"];
    }
    return _typeList;
}

@end
